<?php
define('EmpireCMSAdmin','1');
///require_once("../class/config.php");

require_once("../class/connect.php");
require_once("../class/db_sql.php");
require_once("../class/functions.php");
require_once("../class/t_functions.php");
require_once("../class/hinfofun.php");
require_once("../class/user.php");
require_once("../class/page_obj.php");
require(ECMS_PATH.'e/data/dbcache/class1.php');
require(ECMS_PATH.'e/data/dbcache/ztclass.php');
///活动===发起人口碑

$link=db_connect();
$empire=new mysqlquery();
$db="phome_enewsinfovote";
$db2="phome_ecms_actives";
$id=$_REQUEST['id'];

$h=DbTouch($db,array("id"=>$id));
if(empty($h)){
	$name0=array('差','一般','好');
	$name=	array('很差','差','一般','好','很好');
	$name2=array('完全不符','收费不符','行程不符','符合','完全符合');
	$num=array_pad(array(0),4,0);
	if(DbTouch($db2,array('id'=>$id))){										$extend=array(array('vote_name'=>$name,'vote_num'=>$num),array('vote_name'=>$name,'vote_num'=>$num),array('vote_name'=>$name2,'vote_num'=>$num));
	AddInfoVote(65,$id,array("title"=>"活动投票","vote_name"=>$name0,"vote_num"=>$num,"delvote_id"=>'','vote_id'=>$id),$extend);
	}else{
		echo "<div class='no-data'>记录不存在！</div>";
		exit();
	}	
}
$l=DbTouch($db,array("id"=>$id));
$d1=list_vote_html(get_vote_data($l['votetext'],'vote1'));
$d2=list_vote_html(get_vote_data($l['vote1_text'],'vote2'));
$d3=list_vote_html(get_vote_data($l['vote2_text'],'vote3'));
$d4=list_vote_html(get_vote_data($l['vote3_text'],'vote4'));
$VD=jatGetVoteInfo($id);
//$VD=array_reverse($VD);
$total=getVoteTotalNum($VD[0]);				
$per1=(int)($VD[0][0]['num']/($total==0?1:$total)*100);
$per2=(int)($VD[0][1]['num']/($total==0?1:$total)*100);
$per3=(int)($VD[0][2]['num']/($total==0?1:$total)*100);
$width1=ceil($per1*1.25);
$width2=ceil($per2*1.25);
$width3=ceil($per3*1.25);
//print_r($VD);
$f1=getVoteTotalFen($VD[1]);
$f2=getVoteTotalFen($VD[2]);
$f3=getVoteTotalFen($VD[3]);
$detail=substr($f1*10,1,1);
if($detail>0 && $detail<5){
	$detail=0;
}elseif($detail>5){
	$detail=5;
}
$x1=substr($f1*10,0,-1).$detail;
//////////////////////////////////////////
$detail=substr($f2*10,1,1);
if($detail>0 && $detail<5){
	$detail=0;
}elseif($detail>5){
	$detail=5;
}
$x2=substr($f2*10,0,-1).$detail;

$detail=substr($f3*10,1,1);
if($detail>0 && $detail<5){
	$detail=0;
}elseif($detail>5){
	$detail=5;
}
$x3=substr($f3*10,0,-1).$detail;


?>
<style>



</style>
<div style='margin-left:100px;'>
<table class="onvote_info" id="optwrap" cellspacing="0" cellpadding="0">
 <tbody>
 <tr><td colspan='4' class='vote-t'>总评：</td></tr>
		<tr id="tr_1" class="">
		  <th class="oi_text"><span id="txt_1">好评率</span></th>
		  <td class="oi_numline"><div id="an_1" class="oi_numline1" style="width:<?=$width3?>px; "><span></span></div></td>
		  <td class="oi_num"><span id="num_1"><?php 					
			
		  if($total!=0){ echo $VD[0][2]['num'];}		  
		  ?></span><span id="per_1"><?php echo ($total==0?'':"(".$per3."%)") ?></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_1" style="display:none"></span>  
			
		  </td>
		</tr>
	    <tr id="tr_2" class="oi_success">
		  <th class="oi_text"><span id="txt_2">中评率</span></th>
		  <td class="oi_numline"><div id="an_2" class="oi_numline2" style="width: <?=$width2?>px; "><span></span></div></td>
		  <td class="oi_num"><span id="num_2"><?php 		
			
		  if($total!=0){echo  $VD[0][1]['num'];}		  
		  ?></span><span id="per_2"><?php echo ($total==0?'':"(".$per2."%)") ?></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_2" style=""></span>
		
		  </td>
      </tr>
	 	   <tr id="tr_3" class="oi_success">
		  <th class="oi_text"><span id="txt_3">差评率</span></th>
		  <td class="oi_numline"><div id="an_3" class="oi_numline3" style="width: <?=$width1?>px; "><span></span></div></td>
		  <td class="oi_num"><span id="num_2"><?php 			
			
		  if($total!=0){echo  $VD[0][0]['num'];}		  
		  ?></span><span id="per_2"><?php echo ($total==0?'':"(".$per1."%)") ?></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_2" style=""></span>			
		  </td>
      </tr>
 <tr><td colspan='4' class='vote-t'>分项得分：</td></tr>
	  <tr id="tr_3" class="oi_success">
		  <th class="oi_text"><span id="txt_3">线路精彩程度：</span></th>
		  <td ><span class="ll bigstar<?=$x1?>"></span></td>
		  <td class="oi_num"><span id="num_2"><?=$f1?></span><span id="per_2"></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_2" style=""></span>			
		  </td>
      </tr>      </tr>
	 	   <tr id="tr_3" class="oi_success">
		  <th class="oi_text"><span id="txt_3">领队带队水平：</span></th>
		  <td ><span class="ll bigstar<?=$x2?>"></span></td>
		  <td class="oi_num"><span id="num_2"><?=$f2?></span><span id="per_2"></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_2" style=""></span>			
		  </td>
      </tr>      </tr>
	 	   <tr id="tr_3" class="oi_success">
		  <th class="oi_text"><span id="txt_3">描述符合程度：</span></th>
		  <td ><span class="ll bigstar<?=$x3?>"></span></td>
		  <td class="oi_num"><span id="num_2"><?=$f3?></span><span id="per_2"></span></td>
		  <td class="oi_input"><span class="oi_right" id="sp_2" style=""></span>			
		  </td>
      </tr>
	</tbody>
</table>
</div>
<table class='vote_list'>
	<tr><th class='vote-t'>总体点评：</th><th colspan='4'></th></tr>
	<tr><th></th><?=$d1?></tr>
	<tr><th class='vote-t'>分项点评：</th><th colspan='4'></th></tr>
	<tr><th>线路精彩程度:</th><td></td></tr>
	<tr><th></th><?=$d2?></tr>
	<tr><th>领队带队水平:</th><td></td></tr>
	<tr><th></th><?=$d3?></tr>
	<tr><th>描述符合程度</th><td></td></tr>
	<tr><th></th><?=$d4?></tr>
	<tr><td colspan='5'></td></tr>
</table>
<div style='text-align:center;'><input type='button' class='ok-submit vote-button' value='提交'/></div>